<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>


    <script>
        //狗类
        //不是面向对象的语言（没有类的概念）  封装来实现

        // function dog(name) {
        //     return {
        //         name: name
        //     }
        // }

        // let dog1 = dog("ahuang");
        // console.log(dog1)
        // let cat1 = dog("mimi");
        // console.log(cat1)


        function Dog(name) { //构造函数
            this.name = name
        }
        let dog1 = new Dog("xixi") //this  指向的是实例化出来的这个对象
        console.log(dog1)
            //let dog2 = new Dog("ahuang")
    </script>
</body>

</html>